package com.micro.modual.controller;

import com.micro.core.resp.RespJsonData;
import com.micro.core.resp.RespJsonPageData;
import com.micro.modual.model.dto.member.MemberAccountDTO;
import com.micro.modual.model.dto.member.MemberDetailDTO;
import com.micro.modual.model.dto.member.MemberListDTO;
import com.micro.modual.model.dto.member.MemberStatisticsInfoDTO;
import com.micro.modual.service.MemberService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author LevelCoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020/7/23
 */
@Api(value = "会员管理",tags = "会员管理")
@RestController
@RequestMapping(value = "/member")
public class MemberController {

    @Autowired
    private MemberService memberService;

    /**
     * <h2>查询会员列表</h2>
     * @param map
     * @return
     */
    @GetMapping(value = "/findMemberList")
    public RespJsonPageData<MemberListDTO> findMemberList(@RequestParam Map<String,Object> map){
        return memberService.findMemberList(map);
    }

    /**
     * <h2>查询会员基础信息</h2>
     * @param memberCode 会员编号
     * @return
     */
    @GetMapping(value = "/findMemberDetail/{memberCode}")
    public RespJsonData<MemberDetailDTO> findMemberDetail(@PathVariable("memberCode") String memberCode){
        return memberService.findMemberDetail(memberCode);
    }

    /**
     * <h2>查询会员统计信息</h2>
     * @param memberCode 会员编号
     * @return
     */
    @GetMapping(value = "/findMemberStatisticsInfoDetail/{memberCode}")
    public RespJsonData<MemberStatisticsInfoDTO> findMemberStatisticsInfoDetail(@PathVariable("memberCode") String memberCode){
        return memberService.findMemberStatisticsInfoDetail(memberCode);
    }


    /**
     * 查询用户账户流水
     * @param map
     * @return
     */
    @GetMapping(value = "/findMemberAccountList")
    public RespJsonPageData<MemberAccountDTO> findMemberAccountList(@RequestParam Map<String,Object> map){
        return memberService.findMemberAccountList(map);
    }

}
